/*
* 苏州海管家物流科技有限公司（https://www.hgj.com/）.
* 苏公网安备32059002003385号 © 2015-2022 Hgj.com All Rights Reserved. | 苏ICP备15030950号.
* @Date: 2022.07.31.
* @Author
* @Description 企点管理后台 - 项目接口封装 - 根据请求类型封装 .
**/
import request, { singleRequest } from "@/utils/request"
import { E_HTTP_METHOD } from '@/utils/type'

/**
 *@Description
 *@Return get 方式请求 方法.
 **/
export function getData (url: string, params?: Record<string, unknown>) {
    return request({
        url,
        params,
        method: E_HTTP_METHOD.GET
    })
}
/**
 *@Description
 *@Return post 方式请求 方法.
 **/
export function postData1 (url: string, data?: Record<string, unknown>) {
    return request({
        url,
        data,
        method: E_HTTP_METHOD.POST
    })
}
/**
 *@Description
 *@Return post 方式请求 方法.
 **/
export const postData = async (url: string, data?: Record<string, unknown>) => {
    return await singleRequest({
        url,
        data,
        method: E_HTTP_METHOD.POST
    })
}
/**
 *@Description
 *@Return put 方式请求 方法.
 **/
export function putData(url: string, data?: Record<string, unknown>) {
    return request({
        url,
        data,
        method: E_HTTP_METHOD.PUT
    })
}
/**
 *@Description
 *@Return delete 方式请求 方法.
 **/
export function deleteData(url: string, data?: Record<string, unknown>) {
    return request({
        url,
        data,
        method: E_HTTP_METHOD.DELETE
    })
}
/**
 *@Description
 *@Return patch 方式请求 方法.
 **/
export function patchData(url: string, data?: Record<string, unknown>) {
    return request({
        url,
        data,
        method: E_HTTP_METHOD.PATCH
    })
}
